﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;

namespace RelaxUI
{
    /// <summary>
    /// 
    /// </summary>
    public class MvcResourceManagerBuilder : IHtmlString
    {
        /// <summary>
        /// MVC资源管理释放
        /// </summary>
        public MvcResourceManagerBuilder()
        {
            
            ///注册脚本样式
            ResourseBundle.RegisterBundles(BundleTable.Bundles);
            ///启用压缩
            if (!GlobalConfig.GetDebugMode())
                BundleTable.EnableOptimizations = true;

        }
        /// <summary>
        /// 实现ToHtmlString
        /// </summary>
        /// <returns></returns>
        public string ToHtmlString()
        {
            //var mgr = new MvcResourceManager();
            return  Styles.Render("~/basecss").ToHtmlString() + Styles.Render("~/Resource/themes/css").ToHtmlString() + Scripts.Render("~/basejs").ToHtmlString();
        }
    }

    ///// <summary>
    ///// 
    ///// </summary>
    //public class MvcResourceManager
    //{
    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <returns></returns>
    //    public string SelfRender()
    //    {
    //        string easyUIBasePath = "~/js";
    //        return Scripts.Render(new string[] { easyUIBasePath }).ToHtmlString();
    //    }
    //}
}
